home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / src / Date_Time / calendar.h next >
C/C++ Source or Header  |  1992-04-13  |  2KB  |  92 lines

  1. //
  2. // Copyright (C) 1991 Texas Instruments Incorporated.
  3. //
  4. // Permission is granted to any individual or institution to use, copy, modify,
  5. // and distribute this software, provided that this complete copyright and
  6. // permission notice is maintained, intact, in all copies and supporting
  7. // documentation.
  8. //
  9. // Texas Instruments Incorporated provides this software "as is" without
  10. // express or implied warranty.
  11. //
  12. //
  13. // Created: MBN 04/11/89 -- Initial design and implementation
  14. // Updated: DLS 03/22/91 -- New lite version
  15. //
  16. // This file  contains an enum  definitions  for types day_of_week and months.
  17. // It specifies symbolic constants to be used  as day  and month types.   Note
  18. // that C++  does not distinguish between   an enum  type  and an integer,  so
  19. // function arguments of type `day_of_week' and `month'  are really just `int'
  20. // types.  In addition, ASCII string representations for the  days of the week
  21. // and months  are  provided  in English only.   These can  be  indexed by the
  22. // symbolic enums of the appropriate type.
  23. //
  24. // **NOTE**
  25. // No international  string or  symbolic  representations  are   yet provided.
  26. // These should be added later and can be indexed by the country type.
  27. //
  28.  
  29. #ifndef CALENDARH        // If we have not yet defined the CALENDAR type,
  30. #define CALENDARH        // Indicate that type CALENDAR has been included
  31.  
  32. enum day_of_week {                // Define days type
  33.   SUNDAY,
  34.   MONDAY,
  35.   TUESDAY,
  36.   WEDNESDAY,
  37.   THURSDAY,
  38.   FRIDAY,
  39.   SATURDAY 
  40.   };
  41.  
  42. enum months {                    // Define months type
  43.   JANUARY,
  44.   FEBRUARY,
  45.   MARCH,
  46.   APRIL,
  47.   MAY,
  48.   JUNE,
  49.   JULY,
  50.   AUGUST,
  51.   SEPTEMBER,
  52.   OCTOBER,
  53.   NOVEMBER,
  54.   DECEMBER
  55.   };
  56.  
  57. static const char* day_names[] = {        // Define ASCII day names
  58.   "Sunday",
  59.   "Monday",
  60.   "Tuesday",
  61.   "Wednesday",
  62.   "Thursday",
  63.   "Friday",
  64.   "Saturday",
  65.   };
  66.  
  67. static const char* month_names[] = {        // Define ASCII month names
  68.   "January",
  69.   "February",
  70.   "March",
  71.   "April",
  72.   "May",
  73.   "June",
  74.   "July",
  75.   "August",
  76.   "September",
  77.   "October",
  78.   "November",
  79.   "December"
  80.   };
  81.  
  82. #define SECOND long(1)
  83. #define MINUTE long(60*SECOND)
  84. #define HOUR long(MINUTE*60)
  85. #define DAY long(HOUR*24)
  86. #define WEEK long(DAY*7)
  87. #define YEAR long(WEEK*52)
  88. #define IS_LEAP_YEAR(y) ((((y) % 4) == 0 && \
  89.               ((y) % 100) != 0 || ((y) % 400) == 0) ? TRUE : FALSE)
  90.  
  91. #endif                        // End #ifdef of CALENDARH
  92.